/**
 * 
 */
package com.archerdu.apply.service.impl;

import com.archerdu.apply.dao.ExaminDAO;
import com.archerdu.apply.model.Examin;
import com.archerdu.apply.service.ExaminManager;
import com.archerdu.base.dao.HibernateBaseDao;
import com.archerdu.base.service.BaseManager;

/**
 * @author archer
 * @version 1.0.0
 */
public class ExaminManagerImpl extends BaseManager<Examin, Integer> implements
        ExaminManager {

    private static final long serialVersionUID = 8596375322783640728L;

    private ExaminDAO examinDao;

    @Override
    public void delete(Examin examin) throws Exception {
        if(null == examin || null == examin.getId())
            throw new Exception("没有删除条件");
        examin = examinDao.get(examin.getId());
        
        if(null == examin){
            throw new Exception("要删除的对象不存在");
        }
        super.delete(examin);
    }

    @Override
    public void add(Examin entity) throws Exception {
        entity.setCreatetime(getSqlDate());
        
        super.add(entity);
    }

    public void setExaminDao(ExaminDAO dao) {
        examinDao = dao;
    }

    public ExaminDAO getExaminDao() {
        return examinDao;
    }

    @SuppressWarnings("unchecked")
    @Override
    protected HibernateBaseDao<Examin, Integer> getDao() {
        return (HibernateBaseDao<Examin, Integer>) examinDao;
    }


}
